import * as icons from '@ant-design/icons'

function getIcon(name) {
    const icon = icons[name]
    if (!icon) return null
    return icon.render()
}

const selectIconOptions = Object
    .entries(icons)
    .filter(([key, value]) => key !== 'default' && value.render)
    .map(([key, value]) => ({
        key: key,
        value: key,
        label: <>{value.render()} {key}</>
    }))

export {getIcon, selectIconOptions}